﻿
/*=========================================
* Author: Administrator
* DateTime:2017/6/20 18:29:33
* Description:$safeprojectname$
==========================================*/

using System;
using PureMVC.Interfaces;
using PureMVC.Patterns;
using UnityEngine;

namespace OrderSystem
{
    internal class StartUpCommand : SimpleCommand
    {
        public override void Execute(INotification notification)
        {
            Facade.RegisterCommand(OrderSystemEvent.WAITER_WAIT_CLIENT_HELLO, typeof(WaiterWaitClientHelloCommand));

            Facade.RegisterCommand(ClientEvent.CLIENT_LEAVE, typeof(ClientLeaveCommand));
            //服务员等待送餐，转为空闲时间
            Facade.RegisterCommand(OrderSystemEvent.UPDATE_WAIT_SEND_FOOD, typeof(WaitSendFoodCommand));

            Facade.RegisterCommand(ClientEvent.CLIENT_PAY_TO_WAITER, typeof(ClientPayToWaiterCommand));//客人吃完结账给服务员，买单走人。

            Facade.RegisterCommand(OrderSystemEvent.WAITER_GET_PAY, typeof(WaiterGetPayCommand));

            Facade.RegisterCommand(OrderSystemEvent.UPDATE_WAITER_GET_FOOD, typeof(WaiterGetFoodFromCookCommand));//服务员取菜，更新状态。
           
            Facade.RegisterCommand(OrderSystemEvent.WAITER_WAIT_CLIENT_MENU, typeof(WaiterWaitClientMenuCommand));

            Facade.RegisterCommand(OrderSystemEvent.WAITER_SEND_ORDER_TO_COOK, typeof(CookGetOrderFromWaiterCommand));

            Facade.RegisterCommand(OrderSystemEvent.CLIENT_DELIVE_ORDER_TO_WAITER, typeof(WaiterGetOrderFromClientCommand));

            Facade.RegisterCommand(OrderSystemEvent.SEND_FOOD_TO_CLIENT, typeof(SendFoodToClientCommand));//食物送到客人桌上 

            Facade.RegisterCommand(OrderSystemEvent.MODIFY_COOK_STATE, typeof(ModifyCookStateCommand));
           
            Facade.RegisterCommand(OrderSystemEvent.CALL_COOK_MAKE_FOOD, typeof(CallCookMakeFoodCommand));

            Facade.RegisterCommand(ClientEvent.WAITER_SEND_ORDER_TO_CLIENT, typeof(ClientGetOrderFromWaiterCommand));

            Facade.RegisterCommand(ClientEvent.GET_CLIENT_LIST, typeof(ClientCommand));

            Facade.RegisterCommand(ClientEvent.CLIENT_CALL_WAITER, typeof(ClientCallWaiterCommand));
            //菜单代理
            MenuProxy menuProxy = new MenuProxy();
            Facade.RegisterProxy(menuProxy);

            //客户端代理
            ClientProxy clientProxy = new ClientProxy();
            Facade.RegisterProxy(clientProxy);

            //服务员代理
            WaiterProxy waitProxy = new WaiterProxy();
            Facade.RegisterProxy(waitProxy);

            //厨师代理
            CookProxy cookProxy = new CookProxy();
            Facade.RegisterProxy(cookProxy);

            OrderProxy orderProxy = new OrderProxy();
            Facade.RegisterProxy(orderProxy);

            MainUI mainUI = notification.Body as MainUI;

            if(null == mainUI)
                throw new Exception("程序启动失败..");
            Facade.RegisterMediator(new MenuMediator(mainUI.MenuView));
            Facade.RegisterMediator(new ClientMediator(mainUI.ClientView)); 
            Facade.RegisterMediator(new WaiterMediator(mainUI.WaitView));
            Facade.RegisterMediator(new CookMediator(mainUI.CookView));


        }
    }
}